package testGame;


import static org.junit.Assert.*;
import satirGame.Player;
import org.junit.Before;
import org.junit.Test;

public class PlayerTest {
	private Player player;
	@Before
	
	public void setUp() throws Exception 
	{
		player = new Player();
	}

	@Test
	public void testIsNullName() {
		boolean result = false;
		String newName = "";//Test case Null
		player.setName(newName);
		result = player.isNullName();
		//System.out.println(result);
		assertEquals(result, true);
		//fail("Not yet implemented");
	}
	
	@Test
	public void testIsNotNullName() {
		boolean result = false;
		//String newName = "123";//Test case "123"
		String newName = " ";//Test case "space"
		player.setName(newName);
		result = player.isNullName();
		//System.out.println(result);
		assertEquals(result, false);
		//fail("Not yet implemented");
	}

	
	@Test
	public void testIsContainSymbols() {
		boolean result = false;
		//String newName = "#$%";//if more than one same symbol will have problem
		String newName = "%%%"; //Test double symbols
		player.setName(newName);
		result = player.isContainSymbols();
		//System.out.println(result);
		assertEquals(result, false);		
		//fail("Not yet implemented");
	}
	
	@Test
	public void testIsContainChar() { //to be continue tomorrow
		boolean result = false;
		//String newName = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";
		String newName = "aB1";
		//String newName = "aaa";
		player.setName(newName);
		result = player.isContainChar();
		//System.out.println(result);
		assertEquals(result, false);
		//assertEquals(newName, player.getName()); //check player newName will or will not same player.getName()
		//fail("Not yet implemented");
	}
	
	@Test
	public void testIsnameMaxLengthOverflow(){ //to be continue tomorrow
		boolean result = false;
		String newName = "012345678910";//test 0-10, overflow one number, {true}
		//String newName = "0123456789";//test 0-9,{false}
		player.setName(newName);
		result = player.isnameMaxLengthOverflow();
		//System.out.println(result);
		assertEquals(result, true);
		//fail("Not yet implemented");
	}
	
	@Test
	public void testGetScore()
	{ 
		int CurrentScore = 4;//Test Case
		player.addScore(CurrentScore);	
		CurrentScore = player.getScore();
		System.out.println(CurrentScore);
		assertEquals(CurrentScore, player.getScore());
		//fail("Not yet implemented");
	}	
	
	@Test
	public void testAddScore()
	{ 
		int CurrentScore = 4;//Test Case
		int UpdateScore = 0;
		int NewScore = 1;
		
		UpdateScore = CurrentScore + NewScore;
		
		player.addScore(UpdateScore);	
		CurrentScore = player.getScore();
		System.out.println(UpdateScore);
		assertEquals(UpdateScore, player.getScore());
		//fail("Not yet implemented");
	}
}


/*----------------Version detail----------------------------

Modified time: 04:30_24/02/2012

Editor: Pang Wai Yue

Content: 
1.Check PlayerNewRepeat change to do at the StageTest.java
2.Modify the Player.java file
private int RealRole; 
role change to RealRole

Add Check Score Test Case
testGetScore() 
testAddScore()
-----------------------------------------------------------*/

/*----------------Version detail----------------------------

Modified time: 02:37_07/03/2012

Editor: Lam Kit Yung

Content: 

Add variables:
private int GameRole;
private int score=0;
private int step=0;
int playerID; ?  

Add new functions
setRealRole(int role_id)
getRealRole()
setRole(int role_id)
getRole()
addScore(int scoreGet)
getScore()
setID(int id)
getID()
setStep(int sNum)
getStep()

-----------------------------------------------------------*/

/*----------------Version detail----------------------------

Modified time: 02:37_07/03/2012

Editor: Pang Wai Yue

Content: 

Add Check Score Test Case
testGetScore() 
testAddScore()
-----------------------------------------------------------*/